#include <rclcpp/rclcpp.hpp>

class TimeNowNode : public rclcpp::Node {
public:
  TimeNowNode(std::string name) : rclcpp::Node(name) {
    RCLCPP_INFO(this->get_logger(), "This is time node...");
    auto time = this->get_clock()->now();
    RCLCPP_INFO(this->get_logger(), "this->get_clock().now(): %s",
                std::to_string(time.seconds()).c_str());
    auto rclcpp_time = rclcpp::Clock().now();
    RCLCPP_INFO(this->get_logger(), "rclcpp::Clock::now(): %s",
                std::to_string(rclcpp_time.seconds()).c_str());
    auto rclcpp_node_now = rclcpp::Node::now();
    RCLCPP_INFO(this->get_logger(), "rclcpp::Node::now(): %s",
                std::to_string(rclcpp_node_now.seconds()).c_str());
  }
};

int main(int argc, char **argv) {
  rclcpp::init(argc, argv);
  RCLCPP_INFO(rclcpp::get_logger("node_log"), "starting node...");
  auto node = std::make_shared<TimeNowNode>("test_time_now_node");
  rclcpp::spin(node);
  rclcpp::shutdown();

  return 0;
}